//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

import java.util.HashSet;

public class demo_416 {
    public demo_416() {
    }

    public boolean canPartition(int[] nums) {
        HashSet<Integer> set = new HashSet();
        int n = nums.length;
        int count = nums[0];

        for(int i = 1; i < 1 << n; ++i) {
            if (i < n) {
                count += nums[i];
            }

            int sum = 0;

            for(int j = 0; j < n; ++j) {
                if ((i & 1 << j) != 0) {
                    sum += nums[j];
                }
            }

            set.add(sum);
        }

        System.out.println(count);
        if (count % 2 != 0) {
            return false;
        } else {
            return set.contains(count / 2);
        }
    }
}
